package com.example.isoftlangchainai.chatmodelchat;

import dev.langchain4j.model.chat.ChatModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Date :2025/7/14 17:31
 * @Author :chenjun
 */
@RestController
@RequestMapping("/chatmodel")
public class ChatController {

    ChatModel chatModel;

    ChatController(ChatModel chatModel) {
        this.chatModel = chatModel;
    }

    @GetMapping("/model")
    public String model(@RequestParam(value = "message", defaultValue = "Hello") String message) {
//        ChatMessage userMessages = new UserMessage(message);
//        List<ChatMessage> messages = new ArrayList();
//        ChatRequest chatRequest = ChatRequest.builder().messages(userMessages).messages(messages).build();
        return chatModel.chat(message);
    }
}
